<template>
  <div class="m-confirm-box">
    <div class="m-confirm__header">
      <span>{{ title }}</span>
    </div>

    <div class="m-confirm__body">
      <m-svg :name="`msg-warning`"></m-svg>
      <p>{{ content }}</p>
    </div>

    <div class="m-confirm__footer">
      <m-button v-if="showCancelBtn" @click="rejectFun">{{
        cancelBtnText
      }}</m-button>
      <m-button v-if="showConfirmBtn" type="primary" @click="resolveFun">{{
        confirmBtnText
      }}</m-button>
    </div>
  </div>
</template>

<script setup>
import { reactive } from 'vue'
import MSvg from '../svg/m-svg.vue'
import MButton from '../button/m-button.vue'

const props = defineProps({
  title: {
    type: String,
    default: '提示'
  },
  content: String,
  showConfirmBtn: {
    type: Boolean,
    default: true
  },
  confirmBtnText: {
    type: String,
    default: '确认'
  },
  showCancelBtn: {
    type: Boolean,
    default: true
  },
  cancelBtnText: {
    type: String,
    default: '取消'
  },
  resolveFun: Function,
  rejectFun: Function
})
const state = reactive({})
</script>
